﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AVIS.OutBound.WizardAgent
{
    /// <summary>
    /// SOA请求结果对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ResponseBase<T> : IResponse
    {
        /// <summary>
        /// 请求结果数据对象
        /// </summary>
        public T Data { get; set; }

        /// <summary>
        /// 请求返回结果字符串
        /// </summary>
        public string ResponseString { get; set; }

        /// <summary>
        /// 错误码
        /// </summary>
        /// <remarks>一般为5位数字</remarks>
        public int ErrorCode { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorMessage { get; set; }

        /// <summary>
        /// 提醒码
        /// </summary>
        /// <remarks>一般为5位数字</remarks>
        public int WarningCode { get; set; }

        /// <summary>
        /// 提醒信息
        /// </summary>
        public string WarningMessage { get; set; }

        /// <summary>
        /// 是否有异常
        /// </summary>
        public bool HasError { get { return !string.IsNullOrWhiteSpace(ErrorMessage); } }

        /// <summary>
        /// Response名称，在日志文件中标识用
        /// </summary>
        public virtual string ResponseName { get { return this.GetType().FullName; } }
    }
}
